/*
 * Copyright (C) 拾光分享网 
 * All rights reserved, Designed By www.hiai.top.
 * Email：goodsking@163.com.
 */
package top.hiai._admin.reply;

import com.jfinal.kit.Ret;
import com.jfinal.plugin.activerecord.Page;

import top.hiai.common.model.Reply;
import top.hiai.config.BaseController;

/**
* @Author www.hiai.top
* @Email  goodsking@163.com
* @Message 更多资源尽在www.hiai.top
* @Introduction 类的介绍
*/

public class ReplyAdminController extends BaseController{

	ReplyAdminService replyAdminService = ReplyAdminService.me;

	/**
	 * 后台文章管理主页面
	 */
	public void index() {
		Page<Reply> replyPage = replyAdminService.paginate(getParaToInt("p", 1),limtCount);
		setAttr("replyPage", replyPage);
		render("replyList.html");
	}
	
	/**
	 * 锁定评论，不用用户查看
	 */
	public void lock() {
		Ret ret = replyAdminService.lock(getParaToInt("id"));
		renderJson(ret);
	}
	/**
	 * 解锁评论
	 */
	public void unlock() {
		Ret ret = replyAdminService.unlock(getParaToInt("id"));
		renderJson(ret);
	}
	
	/**
	 * 删除评论
	 */
	public void replyDelete(){
		replyAdminService.replyDelete(getParaToInt("rid"),getParaToInt("aid"));
		redirect("/admin/reply");
	}
}